<?php
$sel_us = mysql_query("SELECT * FROM users WHERE username='".$_SESSION['username']."'") or die(mysql_error());
$row_us = mysql_fetch_assoc($sel_us) or die(mysql_error());
$a =  $row_us['id'];
$username = $_SESSION['username'];

$e = $username.$a." ,";

$sel_g = mysql_query('SELECT * FROM groups WHERE names LIKE "%'.$row_us[username].'%" ORDER BY id') or die(mysql_error());

echo "<ul type='square'>";
while($row_g = mysql_fetch_assoc($sel_g)){
$pos = strpos($row_g['names'], $e);
$id = $row_g['id'];
$ee = "1".$username.$a." ,";
$eedd = "1".$username.$a." ,";

if ($pos === false) {}
	echo '<li><i>'.date('Y-m-d / G:i:s', $row_g['date']).'</i> | учителят: ';
	echo $row_g['from_who']."<strong>(".$row_g['tutorial'].")</strong> - ".$row_g['title_group'];
	echo '<div style="float: right;margin-right:10px;">';
	
	if($row_g['chek'] === $ee){
	?>
	<a href="<?php echo 'home_work_see.php?id='.$id.'';?>"><img src="options/see.png" name='<?php echo $id; ?>' alt="See"/></a> 
	<?php
	}
	else {
		echo '<a href="includes/update_y.php?id='.$id.'"><img src="options/check.png" name='.$id.' alt="Check" width="20px"/></a>'; 
		echo '<a href="includes/update_n.php?id='.$id.'"><img src="options/delete.png" name='.$id.' alt="Leave"/></a>'; 
	}
	if($row_g['chek'] = "0") {
		echo "Вие напуснахте: ".$row_g['title_group'];
	}	
	echo '</div>'."<hr width='98%' />".'</li>';	
	}

echo "</ul>";
?>